/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 3e5;

int a[maxn + 1], f[maxn + 2], g[maxn + 2];

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      f[i] = -1;
      g[i] = 0;
    }
    g[n + 1] = 0;
    f[n + 1] = 0;
    int max = 0;
    for (int i = n; i >= 1; --i) {
      if (i + a[i] + 1 <= n + 1 && f[i + a[i] + 1] != -1) {
        f[i] = f[i + a[i] + 1] + 1;
      }
      if (i + a[i] + 1 <= n + 1) g[i] = std::max(g[i + a[i] + 1] + 1, g[i]);
      g[i] = std::max(g[i], max + 1);
      if (f[i] != -1) max = std::max(max, f[i]);
    }
    for (int i = 1; i < n; ++i) {
      if (f[i + 1] == a[i]) {
        cout << 0 << ' ';
      } else if (f[i + 1] != -1 || g[i + 1] >= a[i]) {
        cout << 1 << ' ';
      } else {
        cout << 2 << ' ';
      }
    }
    cout << '\n';
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("E. Multitest Generator.in", "r", stdin);
  freopen("E. Multitest Generator.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
